Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 2 - Control Manager Reference / Control Manager Functions
Defining Your Own User Pane Functions /


MyUserPaneFocusProc

NEW WITH THE APPEARANCE MANAGER

Handles keyboard focus.

The Control Manager declares the type for an application-defined user pane focus function as follows:

typedef pascal ControlPartCode (*ControlUserPaneFocusProc)(
                                 ControlHandle control,
                                 ControlFocusPart action);
The Control Manager defines the data type ControlUserPaneFocusUPP to identify the universal procedure pointer for this application-defined function:

typedef UniversalProcPtr ControlUserPaneFocusUPP;
You typically use the NewControlUserPaneFocusProc macro like this:

ControlUserPaneFocusUPP myControlUserPaneFocusUPP;
myControlUserPaneFocusUPP = NewControlUserPaneFocusProc 
(MyUsePaneFocus);
You typically use the CallControlUserPaneFocusProc macro like this:

CallControlUserPaneFocusProc(myControlUserPaneFocusUPP, control, action);
Here's how to declare the function MyUserPaneFocusProc:

pascal ControlPartCode MyUserPaneFocusProc (
                     ControlHandle control
                     ControlFocusPart action);
control
A handle to the control that is to adjust its focus.
action
The part code of the user pane to receive keyboard focus; see "Handling Keyboard Focus".
function result
Returns the part of the user pane actually focused. kControlFocusNoPart is returned if the user pane has lost the focus or cannot be focused.
DISCUSSION
Your MyUserPaneFocusProc function is called in response to a change in keyboard focus. It should respond by changing keyboard focus based on the part code passed in the action parameter.

This function will only get called if you've set the kControlSupportsFocus feature bit on creation of the user pane control. Once you have created the function MyUserPaneFocusProc, pass kControlUserPaneFocusProcTag in the tagName parameter of SetControlData.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998